<template>
	<view style="padding: 30rpx;">
		<button @click="onSetTimeOut()" type="primary">单次计时器</button>
		<button @click="onSetTimeOut('qsq',777)">启动传参计时器</button>
		<button @click="onClearTimeOut()" type="warn">取消计时器</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			onSetTimeOut(){
				console.log("onSetTimeOut()");
				// setTimeout(callback,ms,args)
				this.timer1=setTimeout(()=>{
					console.log("onSetTimeOut() callback");
					// ...
					console.log("onSetTimeOut() callback end");
				},3000);
			},
			onSetTimeOut(username,pwd){
				console.log("onSetTimeOut()",username,pwd);
				// ()=>{ }
				setTimeout((x,y)=>{
					console.log("-------callback",x,y);
				},2000,username,pwd)
			}
		},
		onClearInterval(){
			console.log("onClearInterval> 取消周期打印！");
			clearInterval(this.timer2);
		}
	}
</script>

<style>
button{
	margin: 30rpx;
}
</style>
